package pl.com.qapps.datastore.base;

import java.util.ArrayList;
import java.util.List;

import pl.com.qapps.datastore.EntityStore;

import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.google.storage.onestore.v3.OnestoreEntity.EntityProto;
import com.google.storage.onestore.v3.OnestoreEntity.Path;

/**
 * I don't think it will be ever used because protobuf is unnecessary since the
 * way entities/keys are stored is really precisely set up.
 * 
 * @author kuba
 * 
 */
public abstract class ProtoEntityStore implements EntityStore {

	public abstract List<EntityProto> getProtoEntities(List<Path> keys);

	@Override
	public List<Entity> get(List<Key> keys, long revision) {
		ArrayList<Path> protoKeys = new ArrayList<>(keys.size());
		for (Key key : keys) {
			// TODO implement Key to Path conversion
			// protoKeys.add()
			throw new UnsupportedOperationException("not supported yet");
		}

		List<EntityProto> protos = getProtoEntities(protoKeys);
		ArrayList<Entity> entities = new ArrayList<>(protos.size());
		for (EntityProto proto : protos) {
			// TODO implement conversion from EntityProto to Entity
			throw new UnsupportedOperationException("not supported yet");
		}

		return entities;
	}
}
